<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String basePath = "http://" + request.getLocalAddr() + ":"
			+ request.getLocalPort() + request.getContextPath();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<title>${promptInfo.totalDescInfo}</title>
<head>
<script language="javascript" src="<%=request.getContextPath()%>/js/prototype-1.6.0.3.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){

	$("#selectMenu").selectTB({	
		//传值元素ID
		valElementID:'select_default_value',	
		//显示元素ID
		textElementID:'select_default_text',	
		//下拉宽度
		selectWidth:'200',
		//下拉高度	
		selectHeight:'16',	
		//树根描述
		rootName:'顶级机构', 		
		primkeyColumn:['orgID','orgRelation'],
		//要进行树型显示的列，支持一列
		selectShowColumn:'orgName',
		//树型下拉树列表，起始根值
		nodeStartValue:'${session.s_userOrgID}', 
		//描述树形菜单子列
		childNodeColumn:'orgID',
		//描述树形菜单父列
		parentNodeColumn:'orgParentID',	
		//ajax 获取所有树json格式信息
		ajax:{
			//ajax请求url
			url:'ajaxAction.action', 
			//ajax请求参数
			data:'code=${pmsIndex.sys_org_mgr.code}'
		}
	},{
	   animated:false
	}); 
	//input验证
	$.formValidator.initConfig({formid:"actionForm",onerror:function(){alert('校验没有通过，具体错误请看错误提示')},onsuccess:function(){}});//表单提交 
	$("#select_default_value").formValidator({onshow:"请选择机构",onfocus:"请选择机构",oncorrect:"谢谢您的配合"}).inputValidator({min:1,onerror:"机构不能为空,请确认"});
	$("#orgCode").formValidator({onshow:"请输入机构编码",onfocus:"请输入您的机构编码",oncorrect:"谢谢您的配合"}).inputValidator({min:1,onerror:"机构编码不能为空,请确认"}).ajaxValidator({
		//ajax验证
		type : "get",
		url : "ajaxAction.action",
		datatype : "json",
		data: "code=${pmsIndex.sys_check_orgCode.code}",
		success : function(jsonData){
			if( jsonData.singleData == "0" )
			{
                return true;
			}
            else
			{
                return false;
			}
		},
		buttons: $("#button"),
		error: function(){alert("服务器没有返回数据，可能服务器忙，请重试");},
		onerror : "该机构编码已存在，请更换机构编码",
		onwait : "正在对机构编码进行合法性校验，请稍候..."
	});
	$("#orgName").formValidator({onshow:"请输入机构名称",onfocus:"请输入您的机构名称",oncorrect:"谢谢您的配合"}).inputValidator({min:1,onerror:"机构名称不能为空,请确认"});
	$("#orgPhone").formValidator({onshow:"请输入机构电话",onfocus:"格式例如：0577-88888888",oncorrect:"恭喜你,你输对了"}).regexValidator({regexp:"tel",datatype:"enum",onerror:"你输入的机构电话不符合规范"});
	$("#orgFax").formValidator({onshow:"请输入机构传真",onfocus:"格式例如：0577-88888888",oncorrect:"恭喜你,你输对了"}).regexValidator({regexp:"tel",datatype:"enum",onerror:"你输入的机构传真不符合规范"});
	$("#orgPostcode").formValidator({onshow:"请输入邮政编码",onfocus:"请输入您的邮政编码",oncorrect:"谢谢您的配合"}).regexValidator({regexp:"zipcode",datatype:"enum",onerror:"你输入的邮政编码不符合规范"});
	$("#orgAddress").formValidator({onshow:"请输入详细地址",onfocus:"请输入您的详细地址",oncorrect:"谢谢您的配合"}).inputValidator({min:1,onerror:"详细地址不能为空,请确认"});
	$("#orgDesc").formValidator({onshow:"请输入机构描述",onfocus:"请输入您的机构描述",oncorrect:"谢谢您的配合"}).inputValidator({min:1,onerror:"机构描述不能为空,请确认"});
});
</script>
</head>
<body >
<form name="actionForm" method="post" action="operateAction.action" id="actionForm">
<input type="hidden" value="orgName" name="paramMap.logColumn" /> 
<input type="hidden" name="code" value="${code}"> 
<input type="hidden" name="imitateStep" value="${pmsIndex.sys_org_mgr.imitationStep}">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableC">
	<tr>
		<td class="tableCleft">&nbsp;</td>
		<td class="tableCcenter">
		<table width="100%" border="0" cellpadding="0" cellspacing="1" class="SkyTDLine">
			<tr>
				<td class="SkyTDLine">
				<table class="SkyTDLine" cellSpacing="1" cellPadding="0" width="100%" border="0">
					<tr class="MeNewTDLine" align="center">
						<td align="center">
						<table class="Ntable" cellSpacing="1" cellPadding="0" width="100%" border="0">
							<tr class="MeNewTDLine">
								<td align="right" class="SkyTDLine" width="10%">上级机构：</td>
								<td  class="SkyTDLine"> 
									<table border="0" cellpadding="0" cellspacing="0">
										<tr> 
											<td align="left" width="199">
											  <div id="selectMenu">
												<input type="hidden"  id="select_default_value" name="paramMap.select_orgID">
									            <input type="hidden" id="select_default_text">
											  </div>
											</td>
											<td>&nbsp;<font color="red">*</font><span id="select_default_valueTip" style="width:250px"></span></td>
										</tr>
									</table>
								</td>
							</tr>
							<tr class="MeNewTDLine">
								<td align="right" class="SkyTDLine" width="10%">机构编码：</td>
								<td class="SkyTDLine">
											<input name="paramMap.orgCode" type="text" maxlength="20" id="orgCode" style="width: 200;" />
											<font color="red">*</font><span id="orgCodeTip" style="width:250px"></span></td>
							</tr>
							<tr class="MeNewTDLine">                
								<td align="right" class="SkyTDLine" width="10%">机构名称：</td>
								<td class="SkyTDLine"><input name="paramMap.orgName" type="text" maxlength="20" id="orgName"  style="width: 200;" />&nbsp;<font color="red">*</font><span id="orgNameTip" style="width:250px"></span></td>
							</tr>
							<tr class="MeNewTDLine">
								<td align="right" class="SkyTDLine" width="10%">机构电话：</td>
								<td class="SkyTDLine"><input name="paramMap.orgPhone" type="text" maxlength="20" id="orgPhone" style="width: 200;" />&nbsp;<font color="red">*</font><span id="orgPhoneTip" style="width:250px"></span></td>
							</tr>
							<tr class="MeNewTDLine">
								<td align="right" class="SkyTDLine" width="10%">机构传真：</td>
								<td class="SkyTDLine"><input name="paramMap.orgFax" type="text" maxlength="20" id="orgFax" style="width: 200;" />&nbsp;<font color="red">*</font><span id="orgFaxTip" style="width:250px"></span></td>
							</tr>
							<tr class="MeNewTDLine">
								<td align="right" class="SkyTDLine">邮政编码：</td>
								<td class="SkyTDLine"><input name="paramMap.orgPostcode" type="text" maxlength="6" id="orgPostcode" style="width: 200;" />&nbsp;<font color="red">*</font><span id="orgPostcodeTip" style="width:250px"></span></td>
							</tr>
							<tr class="MeNewTDLine">
								<td align="right" class="SkyTDLine">详细地址：</td>
								<td class="SkyTDLine"><input name="paramMap.orgAddress" type="text" maxlength="50" id="orgAddress" style="width: 400;" />&nbsp;<font color="red">*</font><span id="orgAddressTip" style="width:250px"></span></td>
							</tr>							
							<tr class="MeNewTDLine">
								<td align="right" class="SkyTDLine">机构描述：</td>
								<td class="SkyTDLine"><input name="paramMap.orgDesc" type="text" maxlength="50" id="orgDesc" style="width: 400;" />&nbsp;<font color="red">*</font><span id="orgDescTip" style="width:250px"></span></td>
							</tr>
							<tr class="MeNewTDLine" align="center">
								<td align="center" colspan="2" class="SkyTDLine">
								<input type="submit" name="BtnOk" value="创建" id="BtnOk" class="SkyButtonBlur" onMouseOut="this.className='SkyButtonBlur'" onMouseOver="this.className='SkyButtonFocus'" />&nbsp;&nbsp;
								<input type="button" name="BtnReturn" value="返回" id="BtnReturn" class="SkyButtonBlur" onMouseOut="this.className='SkyButtonBlur'" onMouseOver="this.className='SkyButtonFocus'" onclick="window.history.back();" />
								</td>
							</tr>
						</table>
						</td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		</td>
		<td class="tableCright">&nbsp;</td>
	</tr>
</table>
</form>
</body>
</html>
